package com.tanhua.model.vo;

import com.tanhua.model.mongo.RecommendUser;
import com.tanhua.model.mongo.UserLike;
import com.tanhua.model.mongo.Visitors;
import com.tanhua.model.pojo.UserInfo;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.springframework.beans.BeanUtils;

import java.io.Serializable;

/**
 * @Date: 2022/3/6-03-06-21:25
 */
@Data
@NoArgsConstructor
@AllArgsConstructor
public class UserLikeListVo implements Serializable {
    private Long id;
    private String avatar;//用户头像
    private String nickname;//昵称
    private String gender;//性别
    private Integer age;//年龄
    private String city;//城市
    private String education; //学历
    private boolean alreadyLove;//是否互相喜欢
    private Integer marriage; //婚姻状态（0未婚，1已婚）
    private Integer matchRate; //匹配度 (缘分值)

    public static UserLikeListVo init(UserInfo info, Visitors item) {
        UserLikeListVo vo = new UserLikeListVo();
        BeanUtils.copyProperties(info,vo);
        vo.setMatchRate(item.getScore().intValue());
        vo.setAlreadyLove(false);
        return vo;
    }

    public static UserLikeListVo init(UserInfo info, RecommendUser item) {
        UserLikeListVo vo = new UserLikeListVo();
        BeanUtils.copyProperties(info,vo);
        vo.setMatchRate(item.getScore().intValue());
        vo.setAlreadyLove(false);
        return vo;
    }

    public static UserLikeListVo init(UserInfo userInfo, UserLike userLike) {
        UserLikeListVo userLikeListVo = new UserLikeListVo();
        BeanUtils.copyProperties(userInfo, userLikeListVo);
        userLikeListVo.setAlreadyLove(userLike.getIsLike());
        return userLikeListVo;
    }

    public static UserLikeListVo init(UserInfo userInfo) {
        UserLikeListVo userLikeListVo = new UserLikeListVo();
        BeanUtils.copyProperties(userInfo, userLikeListVo);
        userLikeListVo.setAlreadyLove(true);
        return userLikeListVo;
    }

}
